package com.haiya.mediator.conceptdemo;

/**
 * A和B之间发送消息
 *  - A发送消息 B立即收到A发送的消息
 *  - B发送消息 A立即收到B发送的消息
 *
 * 使用中介者进行消息的转发
 */
public class Client {
    public static void main(String[] args) {
        ConcreteMediator mediator = new ConcreteMediator();
        ConcreteColleagueA colleagueA = new ConcreteColleagueA();
        ConcreteColleagueB colleagueB = new ConcreteColleagueB();
        mediator.register(colleagueA);
        mediator.register(colleagueB);

        System.out.println("具体同事A发送消息: ~~~~~~~~~~~~~~~~~~~~~~");
        colleagueA.send("下午有空?");

        System.out.println("具体同事B发送消息: ~~~~~~~~~~~~~~~~~~~~~~");
        colleagueA.send("想吃什么饭?");
    }
}
